package is.hi.translator.tests;

import is.hi.translator.R;
import is.hi.translator.TranslatorActivity;
import android.content.Intent;
import android.test.ActivityUnitTestCase;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class TranslatorActivityTest extends ActivityUnitTestCase<TranslatorActivity> {
	

	private Button translateButton;
	private EditText wordEditText;
	private TextView translationTextView;
	
	public TranslatorActivityTest() {
		super(TranslatorActivity.class);
	}

	public void setUp() throws Exception {
		super.setUp();
        startActivity(new Intent(Intent.ACTION_MAIN), null, null);
		
		wordEditText = (EditText) getActivity().findViewById(R.id.WordEditText);
		translationTextView = (TextView) getActivity().findViewById(R.id.TranslationTextView);
		translateButton = (Button) getActivity().findViewById(R.id.TranslateButton);
	}
	
	public void testTranslate() {
		wordEditText.setText("hestur");
		translateButton.performClick();
		assertEquals("horse",translationTextView.getText().toString());
	}
}
